#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
int main()
{
  pid_t id=fork();
  //id:0子进程，>0：父进程
  if(id == 0)
  {
    //child
    while(1)
    {
      printf("i am child,pid:%d,ppid:%d\n",getpid(),getppid());
      sleep(1);
    }
  }
  else 
  {
    //father
    while(1)
    {
      printf("i am father,pid:%d,ppid:%d\n",getpid(),getppid());
      sleep(1);
    }
  }
  //printf("hello bit! id:%d\n",id);
  //sleep(1);
  //while(1)
  //{
  //  printf("i am a process!,pis:%d,ppid:%d\n",getpid(),getppid());
  //  sleep(1);
  //}
}
